A bulky, but relatively brute force, attempt to make an interesting part
authorrobertlipe <robertlipe@gmail.com>
Mon, 25 Jul 2011 02:42:00 +0000 (02:42 +0000)
committerrobertlipe <robertlipe@gmail.com>
Mon, 25 Jul 2011 02:42:00 +0000 (02:42 +0000)
of the code base legal C and C++ at the same time.

This means that things are quite non-C++ right now, but you can only fight
battles on so many fronts...

45 files changed:
gpsbabel/GPSBabel.pro
gpsbabel/an1.c
gpsbabel/an1sym.h
gpsbabel/avltree.c
gpsbabel/cet/ansi_x3_4_1968.h
gpsbabel/cet/ibm891.h
gpsbabel/cet/ibm903.h
gpsbabel/cet/iso_8859_1.h
gpsbabel/cet_util.c
gpsbabel/cetus.c
gpsbabel/copilot.c
gpsbabel/csv_util.c
gpsbabel/defs.h
gpsbabel/garmin.c
gpsbabel/garmin_device_xml.c
gpsbabel/garmin_tables.c
gpsbabel/gbfile.c
gpsbabel/gbser_posix.c
gpsbabel/geo.c
gpsbabel/gpspilot.c
gpsbabel/gpx.c
gpsbabel/gtm.c
gpsbabel/inifile.c
gpsbabel/itracku.c
gpsbabel/jeeps/garminusb.h
gpsbabel/jeeps/gps.h
gpsbabel/jeeps/gpsapp.c
gpsbabel/jeeps/gpscom.c
gpsbabel/jeeps/gpsdevice_usb.c
gpsbabel/jeeps/gpslibusb.c
gpsbabel/jeeps/gpsprot.c
gpsbabel/jeeps/gpsprot.h
gpsbabel/jeeps/gpsserial.c
gpsbabel/jeeps/gpsusbcommon.c
gpsbabel/kml.c
gpsbabel/magproto.c
gpsbabel/make-an1sym.pl
gpsbabel/mapsource.c
gpsbabel/mkshort.c
gpsbabel/nmea.c
gpsbabel/psp.c
gpsbabel/trackfilter.c
gpsbabel/vmem.c
gpsbabel/waypt.c
gpsbabel/wbt-200.c

index 6d4cd5fbd6eb0ef9b032e753fc1a5cb57fd9e1a4..f8183cc9113e1a61c402fbe343168ecc80b6232d 100644 (file)
@@ -6,66 +6,66 @@ CONFIG -= app_bundle
 
 TEMPLATE = app
 
-MINIMAL_FMTS = magproto.c gpx.c geo.c mapsend.c mapsource.c garmin.c \
-               garmin_device_xml.c garmin_tables.c internal_styles.c nmea.c \
-               kml.c wbt-200.c
-
-ALL_FMTS=$$MINIMAL_FMTS gtm.c gpsutil.c pcx.c cetus.c copilot.c \
-        gpspilot.c magnav.c skytraq.c \
-        psp.c holux.c tmpro.c tpg.c tpo.c \
-        xcsv.c gcdb.c tiger.c easygps.c quovadis.c \
-        gpilots.c saroute.c navicache.c psitrex.c geoniche.c delgpl.c \
-        ozi.c text.c html.c palmdoc.c netstumbler.c hsa_ndv.c \
-        igc.c brauniger_iq.c shape.c hiketech.c glogbook.c coastexp.c \
-        vcf.c overlay.c google.c xhtmlent.c lowranceusr.c an1.c tomtom.c \
-        tef_xml.c maggeo.c pathaway.c vitosmt.c gdb.c bcr.c coto.c \
-        ignrando.c stmwpp.c msroute.c cst.c nmn4.c mag_pdb.c compegps.c \
-        yahoo.c unicsv.c wfff_xml.c garmin_txt.c axim_gpb.c gpssim.c \
-        stmsdf.c gtrnctr.c dmtlog.c raymarine.c alan.c vitovtt.c \
-        ggv_log.c g7towin.c garmin_gpi.c lmx.c random.c xol.c dg-100.c \
-        navilink.c mtk_logger.c ik3d.c osm.c destinator.c exif.c vidaone.c \
-        igo8.c gopal.c humminbird.c mapasia.c gnav_trl.c navitel.c ggv_ovl.c \
-        jtr.c sbp.c sbn.c mmo.c skyforce.c itracku.c v900.c delbin.c \
-        pocketfms_bc.c pocketfms_fp.c pocketfms_wp.c naviguide.c enigma.c \
-        vpl.c teletype.c jogmap.c bushnell.c bushnell_trl.c wintec_tes.c \
-        subrip.c garmin_xt.c explorist_ini.c \
-
-FILTERS=position.c radius.c duplicate.c arcdist.c polygon.c smplrout.c \
-        reverse_route.c sort.c stackfilter.c trackfilter.c discard.c \
-        nukedata.c interpolate.c transform.c height.c swapdata.c
-
-SHAPE=shapelib/shpopen.c shapelib/dbfopen.c pdbfile.c
+XMINIMAL_FMTS = magproto.cc gpx.cc geo.cc mapsend.cc mapsource.cc garmin.cc \
+               garmin_device_xml.cc garmin_tables.cc internal_styles.cc nmea.cc \
+               kml.cc wbt-200.cc
+
+XALL_FMTS=$$MINIMAL_FMTS gtm.cc gpsutil.cc pcx.cc cetus.cc copilot.cc \
+        gpspilot.cc magnav.cc skytraq.cc \
+        psp.cc holux.cc tmpro.cc tpg.cc tpo.cc \
+        xcsv.cc gcdb.cc tiger.cc easygps.cc quovadis.cc \
+        gpilots.cc saroute.cc navicache.cc psitrex.cc geoniche.cc delgpl.cc \
+        ozi.cc text.cc html.cc palmdoc.cc netstumbler.cc hsa_ndv.cc \
+        igc.cc brauniger_iq.cc shape.cc hiketech.cc glogbook.cc coastexp.cc \
+        vcf.cc overlay.cc google.cc xhtmlent.cc lowranceusr.cc an1.cc tomtom.cc \
+        tef_xml.cc maggeo.cc pathaway.cc vitosmt.cc gdb.cc bcr.cc coto.cc \
+        ignrando.cc stmwpp.cc msroute.cc cst.cc nmn4.cc mag_pdb.cc compegps.cc \
+        yahoo.cc unicsv.cc wfff_xml.cc garmin_txt.cc axim_gpb.cc gpssim.cc \
+        stmsdf.cc gtrnctr.cc dmtlog.cc raymarine.cc alan.cc vitovtt.cc \
+        ggv_log.cc g7towin.cc garmin_gpi.cc lmx.cc random.cc xol.cc dg-100.cc \
+        navilink.cc mtk_logger.cc ik3d.cc osm.cc destinator.cc exif.cc vidaone.cc \
+        igo8.cc gopal.cc humminbird.cc mapasia.cc gnav_trl.cc navitel.cc ggv_ovl.cc \
+        jtr.cc sbp.cc sbn.cc mmo.cc skyforce.cc itracku.cc v900.cc delbin.cc \
+        pocketfms_bc.cc pocketfms_fp.cc pocketfms_wp.cc naviguide.cc enigma.cc \
+        vpl.cc teletype.cc jogmap.cc bushnell.cc bushnell_trl.cc wintec_tes.cc \
+        subrip.cc garmin_xt.cc explorist_ini.cc \
+ALL_FMTS=$$MINIMAL_FMTS
+FILTERS=position.cc radius.cc duplicate.cc arcdist.cc polygon.cc smplrout.cc \
+        reverse_route.cc sort.cc stackfilter.cc trackfilter.cc discard.cc \
+        nukedata.cc interpolate.cc transform.cc height.cc swapdata.cc
+
+SHAPE=shapelib/shpopen.c shapelib/dbfopen.c pdbfile.cc
 
 ZLIB=zlib/adler32.c zlib/compress.c zlib/crc32.c zlib/deflate.c zlib/inffast.c \
         zlib/inflate.c zlib/infback.c zlib/inftrees.c zlib/trees.c \
         zlib/uncompr.c zlib/gzio.c zlib/zutil.c
 
-JEEPS += jeeps/gpsapp.c jeeps/gpscom.c \
-         jeeps/gpsmath.c jeeps/gpsmem.c  \
-         jeeps/gpsprot.c jeeps/gpsread.c \
-         jeeps/gpsdevice.c jeeps/gpsdevice_ser.c jeeps/gpsdevice_usb.c \
-         jeeps/gpsrqst.c jeeps/gpssend.c jeeps/gpsserial.c jeeps/jgpsutil.c \
-         jeeps/gpsusbread.c jeeps/gpsusbsend.c \
-         jeeps/gpsusbcommon.c
+JEEPS += jeeps/gpsapp.cc jeeps/gpscom.cc \
+         jeeps/gpsmath.cc jeeps/gpsmem.cc  \
+         jeeps/gpsprot.cc jeeps/gpsread.cc \
+         jeeps/gpsdevice.cc jeeps/gpsdevice_ser.cc jeeps/gpsdevice_usb.cc \
+         jeeps/gpsrqst.cc jeeps/gpssend.cc jeeps/gpsserial.cc jeeps/jgpsutil.cc \
+         jeeps/gpsusbread.cc jeeps/gpsusbsend.cc \
+         jeeps/gpsusbcommon.cc
 
 
-SUPPORT = queue.c route.c waypt.c filter_vecs.c util.c vecs.c mkshort.c \
-          csv_util.c strptime.c grtcirc.c vmem.c util_crc.c xmlgeneric.c \
-          uuid.c formspec.c xmltag.c cet.c cet_util.c fatal.c rgbcolors.c \
-          inifile.c garmin_fs.c gbsleep.c units.c gbser.c \
-          gbfile.c parse.c avltree.c session.c main.c globals.c
+SUPPORT = queue.cc route.cc waypt.cc filter_vecs.cc util.cc vecs.cc mkshort.cc \
+          csv_util.cc strptime.c grtcirc.cc vmem.cc util_crc.cc xmlgeneric.cc \
+          uuid.cc formspec.cc xmltag.cc cet.cc cet_util.cc fatal.cc rgbcolors.cc \
+          inifile.cc garmin_fs.cc gbsleep.cc units.cc gbser.cc \
+          gbfile.cc parse.cc avltree.cc session.cc main.cc globals.cc
 
 SUBDIRS += jeeps
 
 macx|linux {
   DEFINES += HAVE_NANOSLEEP HAVE_LIBUSB HAVE_LIBEXPAT HAVE_GLOB
   DEFINES += HAVE_VA_COPY HAVE_VA_LIST_AS_ARRAY
-  SOURCES += gbser_posix.c jeeps/gpslibusb.c
+  SOURCES += gbser_posix.cc jeeps/gpslibusb.cc
   INCLUDEPATH += jeeps
   LIBS += -lexpat
 }
 win32 {
-  SOURCES += gbser_win32.c jeeps/gpsusbwin.c
+  SOURCES += gbser_win32.cc jeeps/gpsusbwin.c
 }
 
 linux {
@@ -85,9 +85,9 @@ macx {
 SOURCES += $$ALL_FMTS $$FILTERS $$SUPPORT $$SHAPE $$ZLIB $$JEEPS
 
 # We don't care about stripping things out of the build.  Full monty, baby.
-DEFINES += MAXIMAL_ENABLED
+#DEFINES += MAXIMAL_ENABLED
 DEFINES += FILTERS_ENABLED
-DEFINES += PDBFMTS_ENABLED
-DEFINES += SHAPELIB_ENABLED
-DEFINES += CSVFMTS_ENABLED
-DEFINES += CET_WANTED
+#DEFINES += PDBFMTS_ENABLED
+#DEFINES += SHAPELIB_ENABLED
+#DEFINES += CSVFMTS_ENABLED
+#DEFINES += CET_WANTED
index ea87f6d8b33206bf41a1b834b693bdd81a5a9c79..583c8a2c764660ded22e4a39bd44542c8ef34a06 100644 (file)
@@ -400,7 +400,7 @@ static void Read_AN1_Waypoint(gbfile *f, an1_waypoint_record *wpt)
         *oldurlstr = 0;
       }
 
-      wpt->url = xcalloc(len+1, 1);
+      wpt->url = (char*) xcalloc(len+1, 1);
       memcpy(wpt->url, ofs, len);
       ofs += len;
     }
@@ -409,7 +409,7 @@ static void Read_AN1_Waypoint(gbfile *f, an1_waypoint_record *wpt)
     ofs += 2;
 
     if (len) {
-      wpt->comment = xcalloc(len+1, 1);
+      wpt->comment = (char*) xcalloc(len+1, 1);
       memcpy(wpt->comment, ofs, len);
       ofs += len;
     }
@@ -769,7 +769,7 @@ Write_One_AN1_Waypoint(const waypoint *wpt)
   rec->name = xstrdup(wpt->description);
 
   if (!nogc && wpt->gc_data->id) {
-    char *extra = xmalloc(25 + strlen(wpt->gc_data->placer) + strlen(wpt->shortname));
+    char *extra = (char *) xmalloc(25 + strlen(wpt->gc_data->placer) + strlen(wpt->shortname));
     sprintf(extra, "\r\nBy %s\r\n%s (%1.1f/%1.1f)",
             wpt->gc_data->placer,
             wpt->shortname, wpt->gc_data->diff/10.0,
@@ -1239,9 +1239,9 @@ my_write(void)
 ff_vecs_t an1_vecs = {
   ff_type_file,
   {
-    ff_cap_read | ff_cap_write /* waypoints */,
+    (ff_cap) (ff_cap_read | ff_cap_write)      /* waypoints */,
     ff_cap_write                       /* tracks */,
-    ff_cap_read | ff_cap_write         /* routes */,
+    (ff_cap) (ff_cap_read | ff_cap_write)      /* routes */,
   },
   rd_init,
   wr_init,
index 22d0a9af11fda2935086bc7829f44019e277dcd8..3904fad27c361250cb6b1f7bd71f8123b4e9b327 100644 (file)
@@ -62,7 +62,7 @@
 
 struct defguid {
   GUID guid;
-  char *name;
+  const char *name;
 } default_guids[] = {
   { {0xb610bc70,{0x377e, 0x11d6, 0xaeb3}, {0x00, 0x01, 0x02, 0x31, 0x5f, 0xfd}},
     "Hiker"
index 121277f3952b197b91931fb17afbc42538c16b52..388f7fcc0e4678f057aee74fbb414b065b47cc2a 100644 (file)
@@ -768,9 +768,9 @@ avltree_save_key(avltree_t *tree, const char *key)
 
       if (n8 > tree->key_sz) {
         if (tree->key_sz == 0) {
-          tree->key = xmalloc(n8);
+          tree->key = (char*) xmalloc(n8);
         } else {
-          tree->key = xrealloc((char *)tree->key, n8);
+          tree->key = (char *) xrealloc((char *)tree->key, n8);
         }
         tree->key_sz = n8;
       }
index 3305fb6bf14574925c025fb3a9b6350dca8b78c5..5ecb94bf12c5a7f9a2250fb3e01ca4bfc642a19c 100644 (file)
@@ -37,11 +37,11 @@ const char *cet_cs_alias_ansi_x3_4_1968[] =
 #define cet_ucs4_ofs_ansi_x3_4_1968 128
 #define cet_ucs4_cnt_ansi_x3_4_1968 1
 
-const int cet_ucs4_map_ansi_x3_4_1968[cet_ucs4_cnt_ansi_x3_4_1968];
+const int cet_ucs4_map_ansi_x3_4_1968[cet_ucs4_cnt_ansi_x3_4_1968] = {};
 
 #define cet_ucs4_to_ansi_x3_4_1968_ct 1
 
-const cet_ucs4_link_t cet_ucs4_to_ansi_x3_4_1968_links[cet_ucs4_to_ansi_x3_4_1968_ct];
+const cet_ucs4_link_t cet_ucs4_to_ansi_x3_4_1968_links[cet_ucs4_to_ansi_x3_4_1968_ct] = {};
 
 // #define cet_ucs4_to_ansi_x3_4_1968_extra_ct 200
 
index 2d0f3a6ab15a6d56a919db9daec4bf143d43d786..820e0439b853e6257ce89aa23d66942873a3a6c6 100644 (file)
@@ -34,11 +34,11 @@ const char *cet_cs_alias_ibm891[] =
 #define cet_ucs4_ofs_ibm891 128
 #define cet_ucs4_cnt_ibm891 1
 
-const int cet_ucs4_map_ibm891[cet_ucs4_cnt_ibm891];
+const int cet_ucs4_map_ibm891[cet_ucs4_cnt_ibm891] = {};
 
 #define cet_ucs4_to_ibm891_ct 1
 
-const cet_ucs4_link_t cet_ucs4_to_ibm891_links[cet_ucs4_to_ibm891_ct];
+const cet_ucs4_link_t cet_ucs4_to_ibm891_links[cet_ucs4_to_ibm891_ct] = {};
 
 /*
 #define cet_ucs4_to_ibm891_extra_ct 0
index b9a4d6c19a79ffaea74a321952ee42f62dbf79b6..c7711cdd867b77757cd0ffe1d19f4c7a5c81a788 100644 (file)
@@ -34,11 +34,11 @@ const char *cet_cs_alias_ibm903[] =
 #define cet_ucs4_ofs_ibm903 128
 #define cet_ucs4_cnt_ibm903 1
 
-const int cet_ucs4_map_ibm903[cet_ucs4_cnt_ibm903];
+const int cet_ucs4_map_ibm903[cet_ucs4_cnt_ibm903] = {};
 
 #define cet_ucs4_to_ibm903_ct 1
 
-const cet_ucs4_link_t cet_ucs4_to_ibm903_links[cet_ucs4_to_ibm903_ct];
+const cet_ucs4_link_t cet_ucs4_to_ibm903_links[cet_ucs4_to_ibm903_ct] = {};
 
 /*
 #define cet_ucs4_to_ibm903_extra_ct 0
index 7df74cc0c4738b95c00f4a72a3470f4d742c7cb2..092b6951388229cd668391e275e38fba7219a2c5 100644 (file)
@@ -37,11 +37,11 @@ const char *cet_cs_alias_iso_8859_1[] =
 #define cet_ucs4_ofs_iso_8859_1 256
 #define cet_ucs4_cnt_iso_8859_1 1
 
-const int cet_ucs4_map_iso_8859_1[cet_ucs4_cnt_iso_8859_1];
+const int cet_ucs4_map_iso_8859_1[cet_ucs4_cnt_iso_8859_1] = {};
 
 #define cet_ucs4_to_iso_8859_1_ct 1
 
-const cet_ucs4_link_t cet_ucs4_to_iso_8859_1_links[cet_ucs4_to_iso_8859_1_ct];
+const cet_ucs4_link_t cet_ucs4_to_iso_8859_1_links[cet_ucs4_to_iso_8859_1_ct] = {};
 
 /*
 #define cet_ucs4_to_iso_8859_1_extra_ct 0
index 4eee51593b5668afcdfdca8a9854695e4c146960..612a77217cd16d7f7dc4896c478711564eca14e9 100644 (file)
@@ -402,8 +402,8 @@ cet_check_cs(cet_cs_vec_t *vec)     /* test well sorted link & extra tables */
 static signed int
 cet_cs_alias_qsort_cb(const void *a, const void *b)
 {
-  const cet_cs_alias_t *va = a;
-  const cet_cs_alias_t *vb = b;
+  const cet_cs_alias_t *va = (const cet_cs_alias_t*) a;
+  const cet_cs_alias_t *vb = (const cet_cs_alias_t*) b;
   return case_ignore_strcmp(va->name, vb->name);
 }
 
@@ -444,6 +444,7 @@ cet_cs_vec_t cet_cs_vec_utf8 = {
   0,
   NULL,        /* extra */
   0,   /* extras */
+  NULL,
   NULL
 };
 
@@ -815,7 +816,7 @@ cet_register(void)
     }
     /* create name to vec table */
 
-    list = xcalloc(c, sizeof(*list));
+    list = (cet_cs_alias_t*) xcalloc(c, sizeof(*list));
     i = 0;
     for (p = cet_cs_vec_root; p != NULL; p = p->next) {
       if (p->alias != NULL) {
index 0ea21be8f15d0669cf90b831607eb0d923bccfc2..bbbf9a56a5883080d95eefd4bbf096d7b15b9377 100644 (file)
@@ -624,7 +624,7 @@ data_write(void)
    * Turns out plain old strcmp will do the trick...
    */
 
-  htable = xmalloc(ct * sizeof(*htable));
+  htable = (struct hdr*) xmalloc(ct * sizeof(*htable));
   bh = htable;
 
   QUEUE_FOR_EACH(&waypt_head, elem, tmp) {
@@ -652,7 +652,7 @@ data_write(void)
 
 ff_vecs_t cetus_vecs = {
   ff_type_file,
-  { ff_cap_write | ff_cap_read, ff_cap_read, ff_cap_none },
+  { (ff_cap) (ff_cap_write | ff_cap_read), ff_cap_read, ff_cap_none },
   rd_init,
   wr_init,
   rd_deinit,
index d0ac4c3fa7429f5d5b148933a6694d5dcd3be712..2438471e5fe9c1224209505b6e7bf3e40d48147d 100644 (file)
@@ -251,7 +251,7 @@ copilot_writewpt(const waypoint *wpt)
   struct record4 *rec;
   char *vdata;
 
-  rec = xcalloc(sizeof(*rec)+1141,1);
+  rec = (struct record4 *) xcalloc(sizeof(*rec)+1141,1);
 
   pdb_write_double(&rec->latitude, RAD(wpt->latitude));
   pdb_write_double(&rec->longitude, RAD(-wpt->longitude));
index b0159afbf7213b8438c8b6e5b588c667e957c000..4b758434ea6fcba60b9ae529e6d4a0f1409a9cb5 100644 (file)
@@ -754,7 +754,7 @@ xcsv_file_init(void)
    */
   xcsv_file.type = ff_type_file;
 
-  xcsv_file.mkshort_handle = (struct short_handle *) mkshort_new_handle();
+  xcsv_file.mkshort_handle = mkshort_new_handle();
   xcsv_file.gps_datum = GPS_DATUM_WGS84;
 }
 
index 7377c06564d90bac8416399761bd4258a8fc9a68..466ec7150131203447fe5f9e0a5d5309b8ac2a64 100644 (file)
@@ -625,10 +625,27 @@ void track_recompute(const route_head *trk, computed_trkdata **);
  * All shortname functions take a shortname handle as the first arg.
  * This is an opaque pointer.  Callers must not fondle the contents of it.
  */
-typedef struct short_handle * short_handle;
+// This is a crutch until the new C++ shorthandle goes in.
+#define PRIME 37
+typedef struct {
+  unsigned int target_len;
+  char *badchars;
+  char *goodchars;
+  char *defname;
+  queue namelist[PRIME];
+
+  /* Various internal flags at end to allow alignment flexibility. */
+  unsigned int mustupper:1;
+  unsigned int whitespaceok:1;
+  unsigned int repeating_whitespaceok:1;
+  unsigned int must_uniq:1;
+  unsigned int is_utf8:1;
+} mkshort_handle_imp;
+typedef mkshort_handle_imp* short_handle;
+
 #ifndef DEBUG_MEM
 char *mkshort(short_handle,  const char *);
-void *mkshort_new_handle(void);
+short_handle mkshort_new_handle(void);
 #else
 char *MKSHORT(short_handle,  const char *, DEBUG_PARAMS);
 void *MKSHORT_NEW_HANDLE(DEBUG_PARAMS);
@@ -652,7 +669,7 @@ void setshort_is_utf8(short_handle h, const int is_utf8);
  */
 #define VMFL_NOZERO (1 << 0)
 typedef struct vmem {
-  void *mem;           /* visible memory object */
+  char *mem;           /* visible memory object */
   size_t size;                 /* allocated size of object */
 } vmem_t;
 vmem_t         vmem_alloc(size_t, int flags);
@@ -727,10 +744,10 @@ typedef enum {
 } ff_cap;
 
 #define FF_CAP_RW_ALL \
-       { ff_cap_read | ff_cap_write, ff_cap_read | ff_cap_write, ff_cap_read | ff_cap_write }
+       { (ff_cap) (ff_cap_read | ff_cap_write), (ff_cap) (ff_cap_read | ff_cap_write), (ff_cap) (ff_cap_read | ff_cap_write) }
 
 #define FF_CAP_RW_WPT \
-       { ff_cap_read | ff_cap_write, ff_cap_none, ff_cap_none}
+       { (ff_cap) (ff_cap_read | ff_cap_write), ff_cap_none, ff_cap_none}
 
 /*
  * Format capabilities for realtime positioning.
index 0f57f8b08874bc7192b5900a48b53bb8b3cad26c..72175aa2fb1aceedabeaff22af2bd30e72ca897f 100644 (file)
@@ -105,7 +105,7 @@ rw_init(const char *fname)
 {
   int receiver_short_length;
   int receiver_must_upper = 1;
-  char * receiver_charset = NULL;
+  const char * receiver_charset = NULL;
 
   if (!mkshort_handle) {
     mkshort_handle = mkshort_new_handle();
@@ -893,7 +893,7 @@ waypoint_prepare(void)
   extern queue waypt_head;
   int icon;
 
-  tx_waylist = xcalloc(n,sizeof(*tx_waylist));
+  tx_waylist = (struct GPS_SWay**) xcalloc(n,sizeof(*tx_waylist));
 
   for (i = 0; i < n; i++) {
     tx_waylist[i] = sane_GPS_Way_New();
@@ -1104,7 +1104,7 @@ route_write(void)
   int i;
   int n = 2 * route_waypt_count(); /* Doubled for the islink crap. */
 
-  tx_routelist = xcalloc(n,sizeof(GPS_PWay));
+  tx_routelist = (struct GPS_SWay**) xcalloc(n,sizeof(GPS_PWay));
   cur_tx_routelist_entry = tx_routelist;
 
   for (i = 0; i < n; i++) {
@@ -1150,7 +1150,7 @@ track_prepare(void)
   int i;
   int32 n = track_waypt_count() + track_count();
 
-  tx_tracklist = xcalloc(n, sizeof(GPS_PTrack));
+  tx_tracklist = (struct GPS_STrack**) xcalloc(n, sizeof(GPS_PTrack));
   cur_tx_tracklist_entry = tx_tracklist;
   for (i = 0; i < n; i++) {
     tx_tracklist[i] = GPS_Track_New();
index 6f55ce9ceb1d441f574201577a3ce4710cde1b89..f2cb8c8806fbfa66c726d09633eaf7453f000d40 100644 (file)
@@ -45,7 +45,7 @@ void device_s(const char *args, const char **unused)
   if (my_gdx_info) {
     fatal(MYNAME ": More than one device type found in file.\n");
   }
-  my_gdx_info = xcalloc(sizeof *my_gdx_info, 1);
+  my_gdx_info = (gdx_info*) xcalloc(sizeof *my_gdx_info, 1);
   my_gdx_info->device_desc = xstrdup(args);
 }
 
@@ -116,7 +116,7 @@ static xg_tag_mapping gdx_map[] = {
   { ext_s, cb_cdata, "/Device/MassStorageMode/DataType/File/Location/FileExtension" },
   { base_s, cb_cdata, "/Device/MassStorageMode/DataType/File/Location/BaseName" },
   { dir_s, cb_cdata, "/Device/MassStorageMode/DataType/File/TransferDirection" },
-  { 0, 0, NULL }
+  { 0, (xg_cb_type) 0, NULL }
 };
 
 const gdx_info *
index 3c58cff64b23bbf05385fe8b157a3376bb019bf3..73cebf770ee032d9bb117292a91dd247b98393d1 100644 (file)
@@ -616,7 +616,7 @@ grid_mapping_t gt_mps_grid_names[] = {
   { "bng",     "British National Grid",        grid_bng },
   { "utm",     "UTM",                          grid_utm },
   { "swiss",   "Swiss grid",                   grid_swiss },
-  { NULL,      NULL,   0 }
+  { NULL,      NULL,   (grid_type) 0 }
 };
 
 /* gt_mps_datum_names: */
index be19f38158dfc4ea0b952f77cb2a6cf5760ad8b1..2fd835e5b8354180205997167424c28c8c7fd238 100644 (file)
@@ -84,9 +84,9 @@ gzapi_open(gbfile *self, const char *mode)
       fd = stdout;
     }
     SET_BINARY_MODE(fd);
-    self->handle.gz = gzdopen(fileno(fd), openmode);
+    self->handle.gz = (void **)gzdopen(fileno(fd), openmode);
   } else {
-    self->handle.gz = gzopen(self->name, openmode);
+    self->handle.gz = (void **)gzopen(self->name, openmode);
   }
 
   if (self->handle.gz == NULL) {
@@ -131,7 +131,7 @@ static gbsize_t
 gzapi_read(void *buf, const gbsize_t size, const gbsize_t members, gbfile *self)
 {
   int result = 0;
-  char *target = buf;
+  char *target = (char*) buf;
   int count = size * members;
 
   if (self->back != -1) {
@@ -430,7 +430,7 @@ memapi_write(const void *buf, const gbsize_t size, const gbsize_t members, gbfil
 
   if (self->mempos + count > self->memsz) {
     self->memsz = ((self->mempos + count + 4095) / 4096) * 4096;
-    self->handle.mem = xrealloc(self->handle.mem, self->memsz);
+    self->handle.mem = (unsigned char*) xrealloc(self->handle.mem, self->memsz);
   }
   memcpy(self->handle.mem + self->mempos, buf, count);
   self->mempos += count;
@@ -497,7 +497,7 @@ gbfopen(const char *filename, const char *mode, const char *module)
   const char *m;
   int len;
 
-  file = xcalloc(1, sizeof(*file));
+  file = (gbfile*) xcalloc(1, sizeof(*file));
 
   file->module = xstrdup(module);
   file->mode = 'r'; // default
@@ -589,7 +589,7 @@ gbfopen(const char *filename, const char *mode, const char *module)
 #else
   file->buffsz = 256;
 #endif
-  file->buff = xmalloc(file->buffsz);
+  file->buff = (char *) xmalloc(file->buffsz);
 
   return file;
 }
@@ -728,7 +728,7 @@ int gbvfprintf(gbfile *file, const char *format, va_list ap)
       file->buffsz *= 2;
     }
 
-    file->buff = xrealloc(file->buff, file->buffsz);
+    file->buff = (char*) xrealloc(file->buff, file->buffsz);
   }
   return gbfwrite(file->buff, 1, len, file);
 }
@@ -971,7 +971,7 @@ gbfgetcstr(gbfile *file)
 
     if (len == file->buffsz) {
       file->buffsz += 64;
-      str = file->buff = xrealloc(file->buff, file->buffsz + 1);
+      str = file->buff = (char*) xrealloc(file->buff, file->buffsz + 1);
     }
     str[len] = c;
     len++;
@@ -998,7 +998,7 @@ gbfgetpstr(gbfile *file)
   char *result;
 
   len = gbfgetc(file);
-  result = xmalloc(len + 1);
+  result = (char *) xmalloc(len + 1);
   if (len > 0) {
     gbfread(result, 1, len, file);
   }
@@ -1061,7 +1061,7 @@ gbfgetucs2str(gbfile *file)
 
     if (len+clen >= file->buffsz) {
       file->buffsz += 64;
-      result = file->buff = xrealloc(file->buff, file->buffsz + 1);
+      result = file->buff = (char*) xrealloc(file->buff, file->buffsz + 1);
     }
     memcpy(&result[len], buff, clen);
     len += clen;
@@ -1125,7 +1125,7 @@ gbfgetstr(gbfile *file)
 
     if ((len + 1) == file->buffsz) {
       file->buffsz += 64;
-      result = file->buff = xrealloc(file->buff, file->buffsz + 1);
+      result = file->buff = (char*) xrealloc(file->buff, file->buffsz + 1);
     }
     result[len] = (char)c;
     len++;
index c3ecbf3786526d51f56180a52714715194ab2327..39b957b25acd01c42e8e0ac93475f2b28e6afd85 100644 (file)
@@ -443,7 +443,7 @@ const char *fix_win_serial_name(const char *comname)
  */
 int gbser_read_line(void *handle, void *buf, unsigned len, unsigned ms, int eol, int discard)
 {
-  char *bp = buf;
+  char *bp = (char *) buf;
   unsigned pos = 0;
   hp_time tv;
   get_time(&tv);
index d380d6406fa8a840aef0841bf3c853d01f0ae969..28597b551aef36eac2bf83d3a1d87a841d3f53f9 100644 (file)
@@ -67,7 +67,7 @@ xg_tag_mapping loc_map[] = {
   { wpt_diff,  cb_cdata,       "/loc/waypoint/difficulty" },
   { wpt_terr,  cb_cdata,       "/loc/waypoint/terrain" },
   { wpt_container,cb_cdata,    "/loc/waypoint/container" },
-  { NULL,      0,              NULL }
+  { NULL,      (xg_cb_type)0,          NULL }
 };
 
 void wpt_s(const char *args, const char **unused)
@@ -308,7 +308,7 @@ geo_write(void)
 
 ff_vecs_t geo_vecs = {
   ff_type_file,
-  { ff_cap_read | ff_cap_write, ff_cap_none, ff_cap_none },
+  { (ff_cap) (ff_cap_read | ff_cap_write), ff_cap_none, ff_cap_none },
   geo_rd_init,
   geo_wr_init,
   geo_rd_deinit,
index 4ab38c731544fcd442de19882462f2661fe5c601..a53cdc477b3413b0f0cf42652f1bb751a3d6cedf 100644 (file)
@@ -163,7 +163,7 @@ gpspilot_writewpt(const waypoint *wpt)
   struct record *rec;
   char *vdata;
 
-  rec = xcalloc(sizeof(*rec)+206,1);
+  rec = (struct record*) xcalloc(sizeof(*rec)+206,1);
 
   be_write32(&rec->longitude, si_round(wpt->longitude * 3.6e6));
   be_write32(&rec->latitude, si_round(wpt->latitude * 3.6e6));
index a4cf441fe66cc83b2870a04d12f577c534b80228..834654d1ddbc165e6d479e765b86736afb0b3a47 100644 (file)
@@ -190,7 +190,7 @@ typedef enum {
 } tag_type;
 
 typedef struct {
-  queue queue;
+  struct queue queue;
   char *tagdata;
 } gpx_global_entry;
 
@@ -222,7 +222,7 @@ gpx_add_to_global(gpx_global_entry *ge, char *cdata)
     }
   }
 
-  gep = xcalloc(sizeof(*gep), 1);
+  gep = (gpx_global_entry*) xcalloc(sizeof(*gep), 1);
   QUEUE_INIT(&gep->queue);
   gep->tagdata = xstrdup(cdata);
   ENQUEUE_TAIL(&ge->queue, &gep->queue);
@@ -266,7 +266,7 @@ gpx_write_gdata(gpx_global_entry *ge, const char *tag)
 
 
 typedef struct tag_mapping {
-  tag_type tag_type          /* enum from above for this tag */
+  tag_type tag_type_;          /* enum from above for this tag */
   int tag_passthrough;         /* true if we don't generate this */
   const char *tag_name;                /* xpath-ish tag name */
   unsigned long crc;           /* Crc32 of tag_name */
@@ -404,7 +404,7 @@ tag_mapping tag_path_map[] = {
   { tt_vdop, 0, "/gpx/wpt/vdop", 0UL },
   { tt_vdop, 0, "/gpx/trk/trkseg/trkpt/vdop", 0UL },
   { tt_vdop, 0, "/gpx/rte/rtept/hdop", 0UL },
-  {0, 0, NULL, 0UL}
+  {(tag_type)0, 0, NULL, 0UL}
 };
 
 static tag_type
@@ -413,10 +413,10 @@ get_tag(const char *t, int *passthrough)
   tag_mapping *tm;
   unsigned long tcrc = get_crc32_s(t);
 
-  for (tm = tag_path_map; tm->tag_type != 0; tm++) {
+  for (tm = tag_path_map; tm->tag_type_ != 0; tm++) {
     if ((tcrc == tm->crc) && (0 == strcmp(tm->tag_name, t))) {
       *passthrough = tm->tag_passthrough;
-      return tm->tag_type;
+      return tm->tag_type_;
     }
   }
   *passthrough = 1;
@@ -427,7 +427,7 @@ static void
 prescan_tags(void)
 {
   tag_mapping *tm;
-  for (tm = tag_path_map; tm->tag_type != 0; tm++) {
+  for (tm = tag_path_map; tm->tag_type_ != 0; tm++) {
     tm->crc = get_crc32_s(tm->tag_name);
   }
 }
@@ -627,7 +627,7 @@ tag_log_wpt(const char **attrv)
 
   if ((wpt_tmp->shortname) && (strlen(wpt_tmp->shortname) > 2)) {
     /* copy of the shortname */
-    lwp_tmp->shortname = xcalloc(7, 1);
+    lwp_tmp->shortname = (char *) xcalloc(7, 1);
     sprintf(lwp_tmp->shortname, "%-4.4s%02d",
             &wpt_tmp->shortname[2], logpoint_ct++);
 
@@ -1129,7 +1129,7 @@ gpx_end(void *data, const XML_Char *xml_el)
     wpt_tmp->sat = atof(cdatastrp);
     break;
   case tt_fix:
-    wpt_tmp->fix = atoi(cdatastrp)-1;
+    wpt_tmp->fix = (fix_type)(atoi(cdatastrp)-1);
     if (wpt_tmp->fix < fix_2d) {
       if (!case_ignore_strcmp(cdatastrp, "none")) {
         wpt_tmp->fix = fix_none;
@@ -1226,7 +1226,7 @@ gpx_cdata(void *dta, const XML_Char *xml_el, int len)
     cdatalen = &(cur_tag->cdatalen);
   }
   estr = *cdata;
-  *cdata = xrealloc(*cdata, *cdatalen + len + 1);
+  *cdata = (char*) xrealloc(*cdata, *cdatalen + len + 1);
   estr = *cdata + *cdatalen;
   memcpy(estr, s, len);
   *(estr+len) = '\0';
@@ -1273,7 +1273,7 @@ gpx_rd_init(const char *fname)
   }
 
   if (NULL == gpx_global) {
-    gpx_global = xcalloc(sizeof(*gpx_global), 1);
+    gpx_global = (struct gpx_global*) xcalloc(sizeof(*gpx_global), 1);
     QUEUE_INIT(&gpx_global->name.queue);
     QUEUE_INIT(&gpx_global->desc.queue);
     QUEUE_INIT(&gpx_global->author.queue);
@@ -1347,7 +1347,7 @@ gpx_read(void)
 #if HAVE_LIBEXPAT
   int len;
   int done = 0;
-  char *buf = xmalloc(MY_CBUF_SZ);
+  char *buf = (char*) xmalloc(MY_CBUF_SZ);
   int result = 0;
   int extra;
 
index 4db74f3553b9dfc9b5c6cb9422ac7c3c8604315e..4a23fa6acfeba8364e0409dee9ff2f003d0ecac0 100644 (file)
@@ -78,7 +78,7 @@ fread_string(gbfile *fd)
     return NULL;
   }
 
-  val = xmalloc(len+1);
+  val = (char *) xmalloc(len+1);
   gbfread(val, 1, len, fd);
   while (len != 0 && val[len-1] == ' ') {
     len--;
@@ -100,7 +100,7 @@ fread_string_discard(gbfile *fd)
 static char *
 fread_fixedstring(gbfile *fd, int len)
 {
-  char *val = xmalloc(len+1);
+  char *val = (char *) xmalloc(len+1);
 
   gbfread(val, 1, len, fd);
   while (len != 0 && val[len-1] == ' ') {
index 59e802e039e12a05c9cc266bc3bad9dc75170d6f..16a03c67705b82b1422e80588eeaad65d0bc965c 100644 (file)
@@ -63,7 +63,7 @@ find_gpsbabel_inifile(const char *path)               /* can be empty or NULL */
   }
 
   len = strlen(path);
-  buff = xmalloc(len + 1 + strlen(GPSBABEL_INIFILE) + 1);
+  buff = (char*) xmalloc(len + 1 + strlen(GPSBABEL_INIFILE) + 1);
   strcpy(buff, path);
   if (len > 0) {
     char test = buff[len - 1];
@@ -120,7 +120,7 @@ open_gpsbabel_inifile(void)
     if ((envstr = getenv("HOME")) != NULL) {
       char *path;
 
-      path = xmalloc(strlen(envstr) + 11);
+      path = (char*) xmalloc(strlen(envstr) + 11);
       strcpy(path, envstr);
       strcat(path, "/.gpsbabel");
       name = find_gpsbabel_inifile(path);
index e0d69b5980234e3c14bdb59718165d01a0f9d2be..8c0134f0122be9239f1be47990c474f2b1776718 100644 (file)
@@ -117,7 +117,7 @@ static const char*
 itracku_device_read_string()
 {
   const int size = 1024;
-  char* s = xmalloc(size);
+  char* s = (char*) xmalloc(size);
   gbser_read_line(fd, s, size, 1000, 0, 0);
   dbg(1, "read from device: %s", s);
   return s;
@@ -788,8 +788,8 @@ ff_vecs_t itracku_vecs = {
 ff_vecs_t itracku_fvecs = {
   ff_type_file,
   {
-    ff_cap_read | ff_cap_write /* waypoints */,
-    ff_cap_read | ff_cap_write /* tracks */,
+    (ff_cap) (ff_cap_read | ff_cap_write) /* waypoints */,
+    (ff_cap) (ff_cap_read | ff_cap_write) /* tracks */,
     ff_cap_none /* routes */
   },
   itracku_rd_init,
index 44cd5348167ed7c3b3e88c12961e9abffda425d7..789bfc0e49b1f574e1ec7a629f900989e1ecee34 100644 (file)
@@ -46,13 +46,15 @@ union {
  * OS implementation.
  */
 #define GUSB_MAX_UNITS 20
-struct garmin_unit_info {
+typedef struct {
   unsigned long serial_number;
   unsigned long unit_id;
   unsigned long unit_version;
   char *os_identifier; /* In case the OS has another name for it. */
   char *product_identifier; /* From the hardware itself. */
-} garmin_unit_info[GUSB_MAX_UNITS];
+} garmin_unit_info_t;
+
+extern garmin_unit_info_t garmin_unit_info[GUSB_MAX_UNITS];
 
 int gusb_cmd_send(const garmin_usb_packet *obuf, size_t sz);
 int gusb_cmd_get(garmin_usb_packet *ibuf, size_t sz);
index 48c0e9136ad972b731ff64638b5ad11b1e5b839c..d2e250c71261cee0ae19236cef51aef66252dad4 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef __cplusplus
-extern "C"
-{
+// extern "C"
+//{
 #endif
 
 #ifndef gps_h
@@ -263,9 +263,9 @@ extern "C"
 #include "gpsinput.h"
 #include "gpsproj.h"
 
-  time_t gps_save_time;
-  double gps_save_lat;
-  double gps_save_lon;
+  extern time_t gps_save_time;
+  extern double gps_save_lat;
+  extern double gps_save_lon;
   extern int32  gps_save_id;
   extern double gps_save_version;
   extern char   gps_save_string[GPS_ARB_LEN];
@@ -284,5 +284,5 @@ extern "C"
 #endif
 
 #ifdef __cplusplus
-}
+// }
 #endif
index 21c5f0b39f8e96a1deddd94d88f4cd50265f0a63..293d8bfe2e5480d807242c02bee718664b4212e9 100644 (file)
 #include "garminusb.h"
 #include "gpsusbint.h"
 
+time_t gps_save_time;
+double gps_save_lat;
+double gps_save_lon;
+
 #define XMIN(a,b) (a < b? a : b)
 
 static int32    GPS_A000(const char *port);
@@ -7855,7 +7859,7 @@ void GPS_Prepare_Track_For_Device(GPS_PTrack **trk, int32 *n)
             trkpt->distance_populated = 0;
             trkpt->heartrate = 0;
             trkpt->cadence = 0xff;
-            *trk = xrealloc(*trk, (*n+1) * sizeof(GPS_PTrack));
+            *trk = (struct GPS_STrack**) xrealloc(*trk, (*n+1) * sizeof(GPS_PTrack));
             memmove(&(*trk)[i+1], &(*trk)[i], (*n-i) * sizeof(GPS_PTrack));
             (*trk)[i] = trkpt;
             i++;
index 06ce93a9e129a581b1de65a0e6b3d3439afe6460..eba4af141a3c3181bfb6a41f0fb252590efc02ed 100644 (file)
@@ -1194,7 +1194,7 @@ int32 GPS_Command_Send_Track_As_Course(const char *port, GPS_PTrack *trk, int32
     }
 
     /* Create & append course */
-    crs = xrealloc(crs, (n_crs+1) * sizeof(GPS_PCourse));
+    crs = (struct GPS_SCourse**)xrealloc(crs, (n_crs+1) * sizeof(GPS_PCourse));
     crs[n_crs] = GPS_Course_New();
     if (!crs[n_crs]) {
       return MEMORY_ERROR;
@@ -1207,7 +1207,7 @@ int32 GPS_Command_Send_Track_As_Course(const char *port, GPS_PTrack *trk, int32
     crs[n_crs]->track_index = Unique_Track_Index(crs, n_crs);
 
     /* Create & append new lap */
-    clp = xrealloc(clp, (n_clp+1) * sizeof(GPS_PCourse_Lap));
+    clp = (struct GPS_SCourse_Lap**) xrealloc(clp, (n_clp+1) * sizeof(GPS_PCourse_Lap));
     clp[n_clp] = GPS_Course_Lap_New();
     if (!clp[n_clp]) {
       return MEMORY_ERROR;
@@ -1221,7 +1221,7 @@ int32 GPS_Command_Send_Track_As_Course(const char *port, GPS_PTrack *trk, int32
   }
 
   /* Append new track points */
-  ctk = xrealloc(ctk, (n_ctk+n_trk) * sizeof(GPS_PTrack));
+  ctk = (struct GPS_STrack**) xrealloc(ctk, (n_ctk+n_trk) * sizeof(GPS_PTrack));
   first_new_ctk = n_ctk;
   for (i=0; i<n_trk; i++) {
     if (trk[i]->ishdr && (i>=n_trk || trk[i+1]->ishdr)) {
@@ -1246,7 +1246,7 @@ int32 GPS_Command_Send_Track_As_Course(const char *port, GPS_PTrack *trk, int32
   /* Convert waypoints to course points by searching closest track point &
    * append
    */
-  cpt = xrealloc(cpt, (n_cpt+n_wpt) * sizeof(GPS_PCourse_Point));
+  cpt = (struct GPS_SCourse_Point**) xrealloc(cpt, (n_cpt+n_wpt) * sizeof(GPS_PCourse_Point));
   for (i=0; i<n_wpt; i++) {
     double dist, min_dist = DBL_MAX;
     int min_dist_idx = 0, trk_idx = 0, min_dist_trk_idx = 0;
index 73a4b23d51d67ee05353b45ea5780ca184ac4e4c..11c6703afca04d749fa17a7368b1e0e6cc58a44f 100644 (file)
@@ -24,6 +24,8 @@
 #include "gpsusbint.h"
 #include "gpsusbcommon.h"
 
+garmin_unit_info_t garmin_unit_info[GUSB_MAX_UNITS];
+
 static int32 success_stub(void)
 {
   return 1;
index 752b33b46641787d70a11598b8d9419ca0658312..ef1206b49fd615c2c3335f00de944e7de8500155 100644 (file)
@@ -58,12 +58,23 @@ typedef struct {
 static int gusb_intr_in_ep;
 static int gusb_bulk_out_ep;
 static int gusb_bulk_in_ep;
-static gusb_llops_t libusb_llops;
 
 static usb_dev_handle *udev;
 static int garmin_usb_scan(libusb_unit_data *, int);
 static const gdx_info *gdx;
 
+static int gusb_libusb_get(garmin_usb_packet *ibuf, size_t sz);
+static int gusb_libusb_get_bulk(garmin_usb_packet *ibuf, size_t sz);
+static int gusb_teardown(gpsdevh *dh);
+static int gusb_libusb_send(const garmin_usb_packet *opkt, size_t sz);
+
+static gusb_llops_t libusb_llops = {
+  gusb_libusb_get,
+  gusb_libusb_get_bulk,
+  gusb_libusb_send,
+  gusb_teardown,
+  0
+};
 
 #if __linux__
 static
@@ -79,7 +90,7 @@ char ** os_get_garmin_mountpoints()
 // get mounted...
 char ** os_get_garmin_mountpoints()
 {
-  char **dlist = xcalloc(2, sizeof *dlist);
+  char **dlist = (char **) xcalloc(2, sizeof *dlist);
   dlist[0] = xstrdup("/Volumes/GARMIN");
   dlist[1] = NULL;
   return dlist;
@@ -443,18 +454,12 @@ int garmin_usb_scan(libusb_unit_data *lud, int req_unit_number)
   }
 }
 
-static gusb_llops_t libusb_llops = {
-  gusb_libusb_get,
-  gusb_libusb_get_bulk,
-  gusb_libusb_send,
-  gusb_teardown
-};
 
 int
 gusb_init(const char *portname, gpsdevh **dh)
 {
   int req_unit_number = 0;
-  libusb_unit_data *lud = xcalloc(sizeof(libusb_unit_data), 1);
+  libusb_unit_data *lud = (libusb_unit_data*) xcalloc(sizeof(libusb_unit_data), 1);
 
   *dh = (gpsdevh*) lud;
 
index c935aae78d465701540a8c42114c1a3c9bdd7bde..68d4147d98526973ce4fc89d4efcde8e8bba6324 100644 (file)
@@ -22,6 +22,7 @@
 ** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ** Boston, MA  02111-1307, USA.
 ********************************************************************/
+#define COMMON 
 #include "gps.h"
 #include <stdio.h>
 
index 4b1aff75acce786695589d9011447c81a8302405..3de616848dd0a38bf3ca01c3d409432862cbef9e 100644 (file)
@@ -6,6 +6,10 @@ extern "C"
 #ifndef gpsprotocols_h
 #define gpsprotocols_h
 
+#ifndef COMMON
+#define COMMON extern
+#endif
+
 #include "gps.h"
 
   /*
@@ -63,7 +67,7 @@ extern "C"
 #define pA010 10
 #define pA011 11
 
-  int32 gps_device_command;
+  COMMON int32 gps_device_command;
 
 
   struct COMMANDDATA {
@@ -101,20 +105,20 @@ extern "C"
    * Waypoint Transfer Protocol
    */
 #define pA100 100
-  int32 gps_waypt_transfer;
+  COMMON int32 gps_waypt_transfer;
 
   /*
    * Waypoint category transfer protocol
    */
 #define pA101 101
-  int32 gps_category_transfer;
+  COMMON int32 gps_category_transfer;
 
   /*
    * Route Transfer Protocol
    */
 #define pA200 200
 #define pA201 201
-  int32 gps_route_transfer;
+  COMMON int32 gps_route_transfer;
 
   /*
    * Track Log Transfer Protocol
@@ -123,26 +127,26 @@ extern "C"
 #define pA301 301
 #define pA302 302
 #define pA304 304
-  int32 gps_trk_transfer;
+  COMMON int32 gps_trk_transfer;
 
   /*
    *  Proximity Waypoint Transfer Protocol
    */
 #define pA400 400
-  int32 gps_prx_waypt_transfer;
+  COMMON int32 gps_prx_waypt_transfer;
 
   /*
    *  Almanac Transfer Protocol
    */
 #define pA500 500
-  int32 gps_almanac_transfer;
+  COMMON int32 gps_almanac_transfer;
 
 
   /*
    *  Date Time Transfer
    */
 #define pA600 600
-  int32 gps_date_time_transfer;
+  COMMON int32 gps_date_time_transfer;
 
   /*
    *  FlightBook Transfer Protocol
@@ -154,42 +158,42 @@ extern "C"
    *  Position
    */
 #define pA700 700
-  int32 gps_position_transfer;
+  COMMON int32 gps_position_transfer;
 
 
   /*
    *  Pvt
    */
 #define pA800 800
-  int32 gps_pvt_transfer;
+  COMMON int32 gps_pvt_transfer;
 
   /*
    * Lap Data Transfer
    */
 #define pA906 906
-  int32 gps_lap_transfer;
+  COMMON int32 gps_lap_transfer;
 
   /*
    * Various fitness related
    */
 #define pA1000 1000
-  int32 gps_run_transfer;
+  COMMON int32 gps_run_transfer;
 #define pA1002 1002
-  int32 gps_workout_transfer;
+  COMMON int32 gps_workout_transfer;
 #define pA1004 1004
-  int32 gps_user_profile_transfer;
+  COMMON int32 gps_user_profile_transfer;
 #define pA1005 1005
-  int32 gps_workout_limits_transfer;
+  COMMON int32 gps_workout_limits_transfer;
 #define pA1006 1006
-  int32 gps_course_transfer;
+  COMMON int32 gps_course_transfer;
 #define pA1007 1007
-  int32 gps_course_lap_transfer;
+  COMMON int32 gps_course_lap_transfer;
 #define pA1008 1008
-  int32 gps_course_point_transfer;
+  COMMON int32 gps_course_point_transfer;
 #define pA1009 1009
-  int32 gps_course_limits_transfer;
+  COMMON int32 gps_course_limits_transfer;
 #define pA1012 1012
-  int32 gps_course_trk_transfer;
+  COMMON int32 gps_course_trk_transfer;
 
   /*
    * Waypoint D Type
@@ -211,14 +215,14 @@ extern "C"
 #define pD154 154
 #define pD155 155
 
-  int32 gps_rte_type;
-  int32 gps_waypt_type;
+  COMMON int32 gps_rte_type;
+  COMMON int32 gps_waypt_type;
 
   /*
    * Waypoint category types
    */
 #define pD120 120
-  int32 gps_category_type;
+  COMMON int32 gps_category_type;
 
   /*
    * Rte Header Type
@@ -226,14 +230,14 @@ extern "C"
 #define pD200 200
 #define pD201 201
 #define pD202 202
-  int32 gps_rte_hdr_type;
+  COMMON int32 gps_rte_hdr_type;
 
 
   /*
    * Rte Link Type
    */
 #define pD210 210
-  int32 gps_rte_link_type;
+  COMMON int32 gps_rte_link_type;
 
 
   /*
@@ -244,8 +248,8 @@ extern "C"
 #define pD302 302
 #define pD303 303
 #define pD304 304
-  int32 gps_trk_type;
-  int32 gps_run_crs_trk_type;
+  COMMON int32 gps_trk_type;
+  COMMON int32 gps_run_crs_trk_type;
 
 
   /*
@@ -254,8 +258,8 @@ extern "C"
 #define pD310 310
 #define pD311 311
 #define pD312 312
-  int32 gps_trk_hdr_type;
-  int32 gps_run_crs_trk_hdr_type;
+  COMMON int32 gps_trk_hdr_type;
+  COMMON int32 gps_run_crs_trk_hdr_type;
 
 
 
@@ -266,7 +270,7 @@ extern "C"
 #define pD403 403
 #define pD450 450
 
-  int32 gps_prx_waypt_type;
+  COMMON int32 gps_prx_waypt_type;
 
 
   /*
@@ -277,7 +281,7 @@ extern "C"
 #define pD550 550
 #define pD551 551
 
-  int32 gps_almanac_type;
+  COMMON int32 gps_almanac_type;
 
 
   /*
@@ -285,7 +289,7 @@ extern "C"
    */
 #define pD600 600
 
-  int32 gps_date_time_type;
+  COMMON int32 gps_date_time_type;
 
 
 
@@ -294,7 +298,7 @@ extern "C"
    */
 #define pD700 700
 
-  int32 gps_position_type;
+  COMMON int32 gps_position_type;
 
 
 
@@ -303,7 +307,7 @@ extern "C"
    */
 #define pD800 800
 
-  int32 gps_pvt_type;
+  COMMON int32 gps_pvt_type;
 
   /*
    * Lap Data Type
@@ -313,7 +317,7 @@ extern "C"
 #define pD1011 1011
 #define pD1015 1015
 
-  int32 gps_lap_type;
+  COMMON int32 gps_lap_type;
 
   /*
    * Various fitness related
@@ -321,24 +325,24 @@ extern "C"
 #define pD1000 1000
 #define pD1009 1009
 #define pD1010 1010
-  int32 gps_run_type;
+  COMMON int32 gps_run_type;
 #define pD1002 1002
 #define pD1008 1008
-  int32 gps_workout_type;
+  COMMON int32 gps_workout_type;
 #define pD1003 1003
-  int32 gps_workout_occurrence_type;
+  COMMON int32 gps_workout_occurrence_type;
 #define pD1004 1004
-  int32 gps_user_profile_type;
+  COMMON int32 gps_user_profile_type;
 #define pD1005 1005
-  int32 gps_workout_limits_type;
+  COMMON int32 gps_workout_limits_type;
 #define pD1006 1006
-  int32 gps_course_type;
+  COMMON int32 gps_course_type;
 #define pD1007 1007
-  int32 gps_course_lap_type;
+  COMMON int32 gps_course_lap_type;
 #define pD1012 1012
-  int32 gps_course_point_type;
+  COMMON int32 gps_course_point_type;
 #define pD1013 1013
-  int32 gps_course_limits_type;
+  COMMON int32 gps_course_limits_type;
 
   /*
    * Link protocol type
@@ -347,7 +351,7 @@ extern "C"
 #define pL001 1
 #define pL002 2
 
-  int32 gps_link_type;
+  COMMON int32 gps_link_type;
 
 
 
@@ -370,7 +374,7 @@ extern "C"
   ;
 
   US     GPS_Protocol_Version_Change(US id, US version);
-  int32  GPS_Protocol_Table_Set(US id);
+  COMMON int32  GPS_Protocol_Table_Set(US id);
   void   GPS_Protocol_Error(US tag, US data);
   void   GPS_Unknown_Protocol_Print(void);
 
index cd0c38089025cdaa0c86c9b5454c2c54e5cb28c3..750a410bae3628876e6b68c103d4baca2ee6b387 100644 (file)
@@ -488,7 +488,7 @@ int32 GPS_Serial_Wait(gpsdevh *dh)
 
 int32 GPS_Serial_On(const char *port, gpsdevh **dh)
 {
-  posix_serial_data *psd = xcalloc(sizeof(posix_serial_data), 1);
+  posix_serial_data *psd = (posix_serial_data*) xcalloc(sizeof(posix_serial_data), 1);
   *dh = (gpsdevh*) psd;
 
   if (!GPS_Serial_Open((gpsdevh *) psd,port)) {
index 63a299f638bbb72559afcb67729a1a256e28de27..3d37bcfc1f53c593e889c5d4db8475defc677114 100644 (file)
@@ -210,7 +210,7 @@ gusb_list_units()
 }
 
 void
-gusb_id_unit(struct garmin_unit_info *gu)
+gusb_id_unit(garmin_unit_info_t *gu)
 {
   static const char  oid[12] =
   {20, 0, 0, 0, 0xfe, 0, 0, 0, 0, 0, 0, 0};
index a4095ba0ddb77c0e2f6e333006e129675abe35d1..c6d6329aa84bae8b5bcb9bfaa04cf0ab4f924571 100644 (file)
@@ -51,7 +51,6 @@ static int extrude;
 static int trackdata;
 static int trackdirection;
 static int max_position_points;
-static int export_track;
 static int line_width;
 
 static int indent_level;
@@ -215,7 +214,7 @@ xg_tag_mapping kml_map[] = {
   { trk_coord,         cb_cdata,       "/Placemark/GeometryCollection/LineString/coordinates" },
   { trk_coord,         cb_cdata,       "/Placemark/Polygon/outerBoundaryIs/LinearRing/coordinates" },
   { trk_coord,         cb_cdata,       "/Placemark/LineString/coordinates" },
-  { NULL,      0,              NULL }
+  { NULL,      (xg_cb_type) 0,                 NULL }
 };
 
 static
index b748d0db693dbba108aae2f5204f6c95a8a5edfa..29b4088b523b1c6371a53a872c307859b69345ca 100644 (file)
@@ -92,7 +92,7 @@ typedef struct mag_rte_elem {
 /*
  *  A header of a route.  Related elements of a route belong to this.
  */
-typedef struct mag_rte_head {
+typedef struct mag_rte_head_ {
   queue Q;                     /* Queue head for child rte_elems */
   char *rte_name;
   int nelems;
@@ -225,7 +225,7 @@ static icon_mapping_t *icon_mapping = map330_icon_table;
 static char *
 m315_cleanse(char *istring)
 {
-  char *rstring = xmalloc(strlen(istring)+1);
+  char *rstring = (char*) xmalloc(strlen(istring)+1);
   char *i,*o;
   static char m315_valid_chars[] =
     "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789";
@@ -247,7 +247,7 @@ m330_cleanse(char *istring)
   static char m330_valid_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ "
                                    "abcdefghijklmnopqrstuvwxyz"
                                    "0123456789+-.'/!@#<%^&>()=:\\";
-  char *rstring = xmalloc(strlen(istring)+1);
+  char *rstring = (char*) xmalloc(strlen(istring)+1);
   char *o, *i;
 
   for (o=rstring,i=istring; *i; i++) {
@@ -618,7 +618,7 @@ mag_dequote(char *ibuf)
   while ((esc = strchr(ibuf, 0x1b))) {
     int nremains = strlen(esc);
     if (nremains >= 3) {
-      static const char hex[16] = "0123456789ABCDEF";
+      static const char hex[17] = "0123456789ABCDEF";
       char *c1 = strchr(hex, esc[1]);
       char *c2 = strchr(hex, esc[2]);
       if (c1 && c2) {
@@ -1063,7 +1063,7 @@ mag_rteparse(char *rtemsg)
    * queue head.
    */
   if (frag == 1) {
-    mag_rte_head = xcalloc(sizeof(*mag_rte_head),1);
+    mag_rte_head = (struct mag_rte_head_*) xcalloc(sizeof(*mag_rte_head),1);
     QUEUE_INIT(&mag_rte_head->Q);
     mag_rte_head->nelems = frags;
   }
@@ -1084,7 +1084,7 @@ mag_rteparse(char *rtemsg)
       *p = '\0';
     }
 
-    rte_elem = xcalloc(sizeof(*rte_elem),1);
+    rte_elem = (mag_rte_elem*) xcalloc(sizeof(*rte_elem),1);
     QUEUE_INIT(&rte_elem->Q);
 
     rte_elem->wpt_name = xstrdup(next_stop);
@@ -1098,7 +1098,7 @@ mag_rteparse(char *rtemsg)
      * routepoint.
      */
     if (broken_sportrak && abuf[0]) {
-      rte_elem = xcalloc(sizeof(*rte_elem),1);
+      rte_elem = (mag_rte_elem*) xcalloc(sizeof(*rte_elem),1);
       QUEUE_INIT(&rte_elem->Q);
       rte_elem->wpt_name = xstrdup(abuf);
 
@@ -1379,7 +1379,7 @@ mag_waypt_pr(const waypoint *waypointp)
   isrc = waypointp->notes ? waypointp->notes : waypointp->description;
   owpt = global_opts.synthesize_shortnames ?
          mkshort_from_wpt(mkshort_handle, waypointp) : waypointp->shortname;
-  odesc = isrc ? isrc : "";
+  odesc = isrc ? isrc : (char *)"";
   owpt = mag_cleanse(owpt);
 
   if (global_opts.smart_icons &&
@@ -1602,7 +1602,7 @@ mag_write(void)
 const char ** os_get_magellan_mountpoints()
 {
 #if __APPLE__
-  const char **dlist = xcalloc(2, sizeof *dlist);
+  const char **dlist = (const char**) xcalloc(2, sizeof *dlist);
   dlist[0] = xstrdup("/Volumes/Magellan");
   dlist[1] = NULL;
   return dlist;
index 276699b2ac5de84270346d8a143660b58cbf6ef6..1b6f477283f2cbdcd0fdad8967b1dc478d78959d 100755 (executable)
@@ -278,7 +278,7 @@ print <<'END';
 \r
 struct defguid {\r
        GUID guid;\r
-       char *name;\r
+       const char *name;\r
 } default_guids[] = {\r
 END\r
 }\r
index 0dbac67a2c1263747b3b022ab1334727126d0cd3..182939a28b4abb29de65a887799a08741655dcbd 100644 (file)
@@ -1847,7 +1847,7 @@ mps_write(void)
         fatal(MYNAME ": merge source version is %d, requested out version is %d\n", mps_ver_temp, atoi(mpsverout));
       }
     } else {
-      mpsverout = xmalloc(10);
+      mpsverout = (char *) xmalloc(10);
       sprintf(mpsverout,"%d", mps_ver_temp);
     }
   }
index f177fdc763ff5b9e84a8665526198b2aa80d7497..2d715bf68aa2189da4624e50bb6da08f7c6708bd 100644 (file)
@@ -42,21 +42,6 @@ static const char *DEFAULT_BADCHARS = "\"$.,'!-";
  */
 #define PRIME 37
 
-typedef struct {
-  unsigned int target_len;
-  char *badchars;
-  char *goodchars;
-  char *defname;
-  queue namelist[PRIME];
-
-  /* Various internal flags at end to allow alignment flexibility. */
-  unsigned int mustupper:1;
-  unsigned int whitespaceok:1;
-  unsigned int repeating_whitespaceok:1;
-  unsigned int must_uniq:1;
-  unsigned int is_utf8:1;
-} mkshort_handle;
-
 typedef struct {
   queue list;
   char *orig_shortname;
@@ -93,7 +78,7 @@ unsigned int hash_string(const char *key)
   return hash;
 }
 
-void *
+short_handle
 #ifdef DEBUG_MEM
 MKSHORT_NEW_HANDLE(DEBUG_PARAMS)
 #else
@@ -101,7 +86,7 @@ mkshort_new_handle()
 #endif
 {
   int i;
-  mkshort_handle *h = (mkshort_handle *) xxcalloc(sizeof *h, 1, file, line);
+  mkshort_handle_imp *h = (mkshort_handle_imp *) xxcalloc(sizeof *h, 1, file, line);
 
   for (i = 0; i < PRIME; i++) {
     QUEUE_INIT(&h->namelist[i]);
@@ -119,7 +104,7 @@ mkshort_new_handle()
 
 static
 uniq_shortname *
-is_unique(mkshort_handle *h, char *name)
+is_unique(mkshort_handle_imp *h, char *name)
 {
   queue *e, *t;
   int hash;
@@ -136,7 +121,7 @@ is_unique(mkshort_handle *h, char *name)
 
 static
 void
-add_to_hashlist(mkshort_handle *h, char *name)
+add_to_hashlist(mkshort_handle_imp *h, char *name)
 {
   int hash = hash_string(name);
   uniq_shortname *s = (uniq_shortname*) xcalloc(1, sizeof(uniq_shortname));
@@ -146,7 +131,7 @@ add_to_hashlist(mkshort_handle *h, char *name)
 }
 
 char *
-mkshort_add_to_list(mkshort_handle *h, char *name)
+mkshort_add_to_list(mkshort_handle_imp *h, char *name)
 {
   uniq_shortname *s;
 
@@ -174,7 +159,7 @@ mkshort_add_to_list(mkshort_handle *h, char *name)
 void
 mkshort_del_handle(short_handle *h)
 {
-  mkshort_handle *hdr = (mkshort_handle*) *h;
+  mkshort_handle_imp *hdr = (mkshort_handle_imp*) *h;
   int i;
 
   if (!h || !hdr) {
@@ -275,7 +260,7 @@ replace_constants(char *s)
 void
 setshort_length(short_handle h, int l)
 {
-  mkshort_handle *hdl = (mkshort_handle *) h;
+  mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
   if (l == 0) {
     hdl->target_len = DEFAULT_TARGET_LEN;
   } else {
@@ -290,7 +275,7 @@ setshort_length(short_handle h, int l)
 void
 setshort_whitespace_ok(short_handle h, int l)
 {
-  mkshort_handle *hdl = (mkshort_handle *) h;
+  mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
   hdl->whitespaceok = l;
 }
 
@@ -302,7 +287,7 @@ setshort_whitespace_ok(short_handle h, int l)
 void
 setshort_repeating_whitespace_ok(short_handle h, int l)
 {
-  mkshort_handle *hdl = (mkshort_handle *) h;
+  mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
   hdl->repeating_whitespaceok = l;
 }
 
@@ -313,7 +298,7 @@ setshort_repeating_whitespace_ok(short_handle h, int l)
 void
 setshort_defname(short_handle h, const char *s)
 {
-  mkshort_handle *hdl = (mkshort_handle *) h;
+  mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
   if (s == NULL) {
     fatal("setshort_defname called without a valid name.");
   }
@@ -331,7 +316,7 @@ setshort_defname(short_handle h, const char *s)
 void
 setshort_badchars(short_handle h, const char *s)
 {
-  mkshort_handle *hdl = (mkshort_handle *) h;
+  mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
 
   if ((hdl->badchars != NULL)) {
     xfree(hdl->badchars);
@@ -346,7 +331,7 @@ setshort_badchars(short_handle h, const char *s)
 void
 setshort_goodchars(short_handle h, const char *s)
 {
-  mkshort_handle *hdl = (mkshort_handle *) h;
+  mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
 
   if (hdl->goodchars != NULL) {
     xfree(hdl->goodchars);
@@ -364,7 +349,7 @@ setshort_goodchars(short_handle h, const char *s)
 void
 setshort_mustupper(short_handle h, int i)
 {
-  mkshort_handle *hdl = (mkshort_handle *) h;
+  mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
   hdl->mustupper = i;
 }
 
@@ -376,7 +361,7 @@ setshort_mustupper(short_handle h, int i)
 void
 setshort_mustuniq(short_handle h, int i)
 {
-  mkshort_handle *hdl = (mkshort_handle *) h;
+  mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
   hdl->must_uniq = i;
 }
 
@@ -386,7 +371,7 @@ setshort_mustuniq(short_handle h, int i)
 void
 setshort_is_utf8(short_handle h, const int is_utf8)
 {
-  mkshort_handle *hdl = (mkshort_handle *) h;
+  mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
   hdl->is_utf8 = is_utf8;
 }
 
@@ -403,7 +388,7 @@ mkshort(short_handle h, const char *istring)
   char *cp;
   char *np;
   int i, l, nlen, replaced;
-  mkshort_handle *hdl = (mkshort_handle *) h;
+  mkshort_handle_imp *hdl = (mkshort_handle_imp *) h;
 
   if (hdl->is_utf8) {
     ostring = cet_utf8_strdup(istring);  /* clean UTF-8 string */
index 18e608a8eeda1b9183ae2a7f0890581c2d87017b..f55077fda4734b9cd1c7534ebbd8ee5b9d3288ab 100644 (file)
@@ -335,7 +335,7 @@ nmea_wr_init(const char *portname)
     }
   }
 
-  mkshort_handle = (struct short_handle*) mkshort_new_handle();
+  mkshort_handle = mkshort_new_handle();
   setshort_length(mkshort_handle, atoi(snlenopt));
 
   if (opt_gisteq) {
index b6114b27fede4fd3c14afbd16a9ab4e448af3401..2008ab798234eb292c555fdabe9cb8013d6dc2bb 100644 (file)
@@ -77,7 +77,7 @@ psp_read_str(gbfile *fin)
     return NULL;
   }
 
-  buff = xmalloc(len * sizeof(*buff));
+  buff = (gbint16*) xmalloc(len * sizeof(*buff));
   gbfread(buff, sizeof(*buff), len, fin);
   res = cet_str_uni_to_utf8(buff, len);
   xfree(buff);
index 37eadf77cbb893567c13550faf3b1697c49cb013..f70161f44444ab47150d68d28e84d47e35ddbec9 100644 (file)
@@ -288,7 +288,7 @@ trackfilter_parse_fix(int *nsats)
     return fix_none;
   }
   fatal(MYNAME ": invalid fix type\n");
-  return 0;
+  return fix_unknown;
 }
 
 static void
@@ -932,7 +932,7 @@ trackfilter_seg2trk(void)
         dest->rte_num = src->rte_num;
         /* name in the form TRACKNAME #n */
         snprintf(trk_seg_num_buf, sizeof(trk_seg_num_buf), "%d", ++trk_seg_num);
-        dest->rte_name = xmalloc(strlen(src->rte_name)+strlen(trk_seg_num_buf)+3);
+        dest->rte_name = (char*) xmalloc(strlen(src->rte_name)+strlen(trk_seg_num_buf)+3);
         sprintf(dest->rte_name, "%s #%s", src->rte_name, trk_seg_num_buf);
 
         /* Insert after original track or after last newly
index 437b9cd4b9588d39b2972730b2cc917f25ae26b3..64bb5673f8eac54d05a68b1b5bb8760f13463e71 100644 (file)
@@ -31,7 +31,7 @@ vmem_alloc(size_t size, int flags)
    * By default, zero the allocated thingy.
    */
   if (flags & VMFL_NOZERO) {
-    vm.mem = xmalloc(size);
+    vm.mem = (char *) xmalloc(size);
   } else {
     vm.mem = (char *) xcalloc(size, 1);
   }
@@ -61,7 +61,7 @@ vmem_realloc(vmem_t *vm, size_t size)
    * Reallocate only if we must.
    */
   if (size > vm->size) {
-    vm->mem = xrealloc(vm->mem, size);
+    vm->mem = (char *) xrealloc(vm->mem, size);
     vm->size = size;
   }
   return;
index 4d55a7bab03b8680b0a51b75ae3994d187e1e24a..24bb8c650762191fa9fd8a134ad5c76f71b174d1 100644 (file)
@@ -82,7 +82,7 @@ waypt_dupe(const waypoint *wpt)
   }
 
   if (wpt->gc_data != &empty_gc_data) {
-    geocache_data *gc_data = xmalloc(sizeof(*gc_data));
+    geocache_data *gc_data = (geocache_data*) xmalloc(sizeof(*gc_data));
     tmp->gc_data = (const geocache_data *)gc_data;
 
     memcpy(gc_data, wpt->gc_data, sizeof(*gc_data));
@@ -522,7 +522,7 @@ waypt_add_url(waypoint *wpt, char *link, char *url_link_text)
     wpt->url_link_text = url_link_text;
   } else {
     url_link *tail;
-    url_link *new_link = xcalloc(sizeof(url_link), 1);
+    url_link *new_link = (url_link*) xcalloc(sizeof(url_link), 1);
     new_link->url = link;
     new_link->url_link_text = url_link_text;
 
@@ -676,7 +676,7 @@ waypt_alloc_gc_data(waypoint *wpt)
 {
   geocache_data *res = (geocache_data *)wpt->gc_data;
   if (res == &empty_gc_data) {
-    res = xcalloc(1, sizeof(*res));
+    res = (geocache_data*) xcalloc(1, sizeof(*res));
     wpt->gc_data = (const geocache_data *)res;
 
   }
index 7fdd4c86e62193481c6cc87e0434e0a1db0dff72..849dc2aa7658a3caa29a751b9b09426c66064b94 100644 (file)
@@ -92,9 +92,11 @@ static FILE *fl;
 static char *port;
 static char *erase;
 
-static enum {
+typedef enum {
   UNKNOWN, WBT200, WBT201, WSG1000
-} dev_type = UNKNOWN;
+} wintec_gps_types;
+
+static wintec_gps_types dev_type = UNKNOWN;
 
 struct buf_chunk {
   struct buf_chunk    *next;
@@ -173,7 +175,7 @@ static void buf_rewind(struct buf_head *h)
 
 static size_t buf_read(struct buf_head *h, void *data, size_t len)
 {
-  char    *bp = data;
+  char    *bp = (char *) data;
   size_t  got = 0;
 
   while (len != 0 && h->current != NULL) {
@@ -206,7 +208,7 @@ static void buf_extend(struct buf_head *h, size_t amt)
   struct buf_chunk *c;
   size_t sz = amt + sizeof(struct buf_chunk);
 
-  c = xmalloc(sz);
+  c = (struct buf_chunk*) xmalloc(sz);
   c->next = NULL;
   c->size = amt;
   c->used = 0;
@@ -236,7 +238,7 @@ static void buf_update_checksum(struct buf_head *h, const void *data, size_t len
 static void buf_write(struct buf_head *h, const void *data, size_t len)
 {
   size_t avail;
-  const char *bp = data;
+  const char *bp = (const char *) data;
 
   buf_update_checksum(h, data, len);
 
@@ -370,7 +372,7 @@ static int wsg1000_try()
   return expect("@AL,2,3,OK");
 }
 
-static int guess_device()
+static wintec_gps_types guess_device()
 {
   int i;
   db(1, "Guessing device...\n");